﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Calculating.aspx.cs" Inherits="Basic4Net.OAWeb.Module_Accounting.Calculating" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link href="../App_Themes/ui-lightness/main.css" rel="stylesheet" type="text/css" />
</head>
<body style="overflow:scroll;overflow-y:hidden;">
    <form id="form1" runat="server" style="padding-top: 100px; text-align:center;">
    <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true">
    </asp:ScriptManager>
    <asp:HiddenField ID="hidHaveMonth" runat="server" />
    <asp:HiddenField ID="hidYear" runat="server" />
    <asp:HiddenField ID="hidMonth" runat="server" />
    <asp:HiddenField ID="hidHaveData" runat="server" />
    <asp:HiddenField ID="hidVidify" runat="server" />
    <div id="divCtrl" style="text-align: left; vertical-align: middle; width: 680px; height:10%; border: 2px solid #c3dce5;
        padding: 50px 50px 50px 50px;">
        <div id="divNoMonth" style="display: none;">
            <label>
                没有激活核算月, 请进入"流程管理"页面设置一个当前核算月.</label>
        </div>
        <div id="divMain">
            <asp:Label ID="labMsg0" runat="server" Text=""></asp:Label>
            <input type="button" id="btnCalculating" class="commonBut" onclick="CalculatingClick();"
                value="核算" />
            <br />
            <br />
            <div id="divLoader" style="display: none;">
                <img src="../App_Themes/ui-lightness/images/ajax-loader.gif"></img>正在进行计算, 请不要关闭或刷新本页面.</div>
        </div>
    </div>
    <div id="divReport" style="text-align: left; width: 100%; height:90%;">
        <iframe id="reportFrame" src="" style="text-align: left; width:100%; height:98%;"></iframe>
    </div>
    </form>
</body>
<script type="text/javascript" src="../Scripts/jquery-1.4.1.js"></script>
<script type="text/javascript" src="../Scripts/common.js"></script>
<script type="text/javascript" src="../Scripts/Util.js"></script>
<script type="text/javascript">
    $(document).ready(function () {

        if ($("#<%=hidHaveMonth.ClientID %>").val() == "0") {
            $("#divNoMonth").css("display", "block");
            $("#divMain").css("display", "none");
        }

        if ($("#<%=hidHaveData.ClientID %>").val() == "1" || $("#<%=hidVidify.ClientID %>").val() == "1") {
            if ($("#<%=hidVidify.ClientID %>").val() == "1")
                $("#btnCalculating").hide();
            $("#divReport").css("height", "95%");
            $("#reportFrame").attr("src", "Adjust.aspx");
            $("#divCtrl").css("width", "95%");
            $("#divCtrl").css("border", "0px");
            $("#divCtrl").css("padding", "0px 0px 0px 9px");
            $("#divCtrl").css("vertical-align", "top");
            $("#form1").css("text-align", "left");
            $("#form1").css("padding-top", "5px");
        }
        else if ($("#<%=hidHaveData.ClientID %>").val() == "1" || $("#<%=hidVidify.ClientID %>").val() == "0") {
            $("#reportFrame").attr("src", "Adjust.aspx");
            $("#divCtrl").css("width", "95%");
            $("#divCtrl").css("border", "0px");
            $("#divCtrl").css("padding", "0px 0px 0px 9px");
            $("#divCtrl").css("vertical-align", "top");
            $("#form1").css("text-align", "left");
            $("#form1").css("padding-top", "5px");
        }
        else {
            $("#divReport").hide();
        }
    });

    // 核算按钮点击
    function CalculatingClick() {
        $("#divLoader").css("display", "block");

        PageMethods.Calculate(Number($("#hidYear").val()), Number($("#hidMonth").val()),
            function (succ) {
                $("#divLoader").css("display", "none");
                if (succ == null || succ.length < 1) {
                    showMassgeBox("提示", "核算成功", 1);

                    ;
                    window.setTimeout("document.location = 'Calculating.aspx';", 3000);
                }
                else
                    showMassgeBox("提示", succ, 1);
                    
            },
            function (err) {
                $("#divLoader").css("display", "none");
                if (err == null || err.length < 1)
                    showMassgeBox("提示", "核算失败", 1);
                else
                    showMassgeBox("提示", err, 1);
            }
        );
    }

</script>
</html>
